﻿using System.Web.Mvc;
using Xenta.Utils;

namespace Xenta.Web.Controllers
{
    /// <summary>
    /// Represents the exteded controller.
    /// </summary>
    public abstract class ExtController : Controller
    {
        #region Properties

        /// <summary>
        /// Gets the service associated with the controller.
        /// </summary>
        public Service Svc
        {
            get
            {
                return HttpContext.Svc();
            }
        }

        #endregion

        #region Utilities

        /// <summary>
        /// Redirects to the specified action using the specified location.
        /// </summary>
        /// <param name="location">The location/</param>
        /// <returns>The redirect result object.</returns>
        protected RedirectToRouteResult RedirectToAction(Loc location)
        {
            return RedirectToAction(location.Action, location.Controller, location.Params);
        }

        #endregion
    }
}